# 集合

# 相当于只有键的字典，内部元素不会重复

# 定义方式

s1 = {1,3,2,5,4,6}

s2 = set("abasawdawd")
print(s1)
print(s2)


# 去重

l = [1,6,8,4,6,8,5,4,1,6,3,5,1,6,4,66,3,5,1,6,4,6,6,8,5,4,6,8,5,4,6,5,6,8,5,4,8,8,9,7,9,84,6,5,1]

print(f"l 的长度为: {len(l)}")

s3 = set(l)     # 强制转为集合
print(s3)
print(f"s3的长度为：{len(s3)}")

print(
    9 in s3
)


# 增加
s3.add(88)      # 添加一个元素

s4 = s3 | {77, 55}      # 并集
print(s4)
